<?php

namespace app\api\validate;

use think\Validate;

class UserAddress extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'real_name'         => 'require',
        'phone'        => 'require|mobile',
        'region'       => 'require',
        'address'      => 'require',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'real_name.require'         => '姓名不能为空',
        'phone.require'        => '手机号不能为空',
        'phone.mobile'         => '手机号格式不正确',
        'region.require'       => '所属地区不能为空',
        'address.require'      => '详细地址不能为空',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['real_name', 'phone', 'region', 'address'],
        'edit' => ['real_name', 'phone', 'region', 'address'],
    ];

}
